package com.ruoyi.web.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.Quartz2;
import com.ruoyi.system.service.IQuartz2Service;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 产品目录管理Controller
 * 
 * @author ruoyi
 * @date 2025-10-28
 */
@RestController
@RequestMapping("/system/quartz2")
public class Quartz2Controller extends BaseController
{
    @Autowired
    private IQuartz2Service quartz2Service;

    /**
     * 查询产品目录管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:quartz2:list')")
    @GetMapping("/list")
    public TableDataInfo list(Quartz2 quartz2)
    {
        startPage();
        List<Quartz2> list = quartz2Service.selectQuartz2List(quartz2);
        return getDataTable(list);
    }

    /**
     * 导出产品目录管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:quartz2:export')")
    @Log(title = "产品目录管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Quartz2 quartz2)
    {
        List<Quartz2> list = quartz2Service.selectQuartz2List(quartz2);
        ExcelUtil<Quartz2> util = new ExcelUtil<Quartz2>(Quartz2.class);
        util.exportExcel(response, list, "产品目录管理数据");
    }

    /**
     * 获取产品目录管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:quartz2:query')")
    @GetMapping(value = "/{catalogId}")
    public AjaxResult getInfo(@PathVariable("catalogId") Long catalogId)
    {
        return success(quartz2Service.selectQuartz2ByCatalogId(catalogId));
    }

    /**
     * 新增产品目录管理
     */
    @PreAuthorize("@ss.hasPermi('system:quartz2:add')")
    @Log(title = "产品目录管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Quartz2 quartz2)
    {
        return toAjax(quartz2Service.insertQuartz2(quartz2));
    }

    /**
     * 修改产品目录管理
     */
    @PreAuthorize("@ss.hasPermi('system:quartz2:edit')")
    @Log(title = "产品目录管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Quartz2 quartz2)
    {
        return toAjax(quartz2Service.updateQuartz2(quartz2));
    }

    /**
     * 删除产品目录管理
     */
    @PreAuthorize("@ss.hasPermi('system:quartz2:remove')")
    @Log(title = "产品目录管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{catalogIds}")
    public AjaxResult remove(@PathVariable Long[] catalogIds)
    {
        return toAjax(quartz2Service.deleteQuartz2ByCatalogIds(catalogIds));
    }
}
